//
//  GoodAttributeAddCell.m
//  ReceiptDelivery
//
//  Created by 吕晶 on 2020/9/24.
//  Copyright © 2020 吕晶. All rights reserved.
//

#import "GoodAttributeAddCell.h"

@interface GoodAttributeAddCell ()

@property (nonatomic, strong) UIButton *addBtn;

@end

@implementation GoodAttributeAddCell

+ (instancetype)GoodAttributeAddCellWithTableView:(UITableView *)tableView {
    static NSString *cellID = @"GoodAttributeAddCell";
    GoodAttributeAddCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[GoodAttributeAddCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = Color_backgroundColor;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.addBtn = [[UIButton alloc] initWithFrame:CGRectMake(15, 10, ScreenW - 30, 50)];
        self.addBtn.backgroundColor = HexColor(0xffffff);
        self.addBtn.layer.masksToBounds = YES;
        self.addBtn.layer.cornerRadius = 6;
        [self.addBtn setTitle:@"添加其他属性" forState:0];
        [self.addBtn setTitleColor:Color_ThemeColor forState:0];
        self.addBtn.titleLabel.font = BoldFontOfSize(16);
        [self.addBtn setImage:[UIImage imageNamed:@"icon_add_yundan_edit"] forState:0];
        [self.addBtn addTarget:self action:@selector(addClick) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:self.addBtn];
        
        self.height = self.addBtn.nim_bottom;
    }
    return self;
}

- (void)addClick {
    if (self.addBlock) {
        self.addBlock();
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
